using System;
using System.Windows;
using CPlatePrintSys.Domain.Events;
using MahApps.Metro.Controls;
using Prism.Events;
using Prism.Ioc;

namespace CPlatePrintSys.Win.Views
{
    public partial class AddStreamShipView : MetroWindow
    {
        private IEventAggregator _eventAggregator;

        public AddStreamShipView()
        {
            _eventAggregator = (IEventAggregator)Prism.Ioc.ContainerLocator.Container.Resolve<IEventAggregator>();
            InitializeComponent();
            this.Loaded += AddStreamShipView_Loaded;
            this.Closed += AddStreamShipView_Closed;
        }

        private void AddStreamShipView_Closed(object sender, EventArgs e)
        {
            _eventAggregator.GetEvent<WindowsPopupedEvent>().Publish(false);
        }

        private void AddStreamShipView_Loaded(object sender, RoutedEventArgs e)
        {
            _eventAggregator.GetEvent<WindowsPopupedEvent>().Publish(true);
        }
    }
} 